﻿//------------------------------------------------------------------------------
// <copyright file="Clip.cs" company="Robert MacLean">
//      Copyright © Robert MacLean.  All Rights Reserved.
// </copyright>
//
//  Details on this see: http://rule18.codeplex.com
//  This code released under the terms of the 
//  Microsoft Reciprocal License (MS-RL, http://opensource.org/licenses/ms-rl.html.)
//------------------------------------------------------------------------------

namespace Rule18.Core
{
    using System;
    using System.Windows.Forms;

    /// <summary>
    /// Defines an individual clip.
    /// </summary>
    public class Clip
    {
        /// <summary>
        /// Gets or sets the id.
        /// </summary>
        /// <value>The id.</value>
        public Guid Id { get; private set; }

        /// <summary>
        /// Gets or sets the key.
        /// </summary>
        /// <value>The key.</value>
        public KeyInfo Key { get; set; }

        /// <summary>
        /// Gets or sets the text.
        /// </summary>
        /// <value>The text.</value>
        public string Text { get; set; }  

        /// <summary>
        /// Gets the display text.
        /// </summary>
        /// <value>The display text.</value>
        public string DisplayText
        {
            get
            {
                if (this.Text.Length < 15)
                {
                    return this.Text;
                }

                return this.Text.Substring(0, 12) + "...";
            }
        }

        /// <summary>
        /// Gets the wide display text.
        /// </summary>
        /// <value>The wide display text.</value>
        public string WideDisplayText
        {
            get
            {
                if (this.Text.Length < 50)
                {
                    return this.Text;
                }

                return this.Text.Substring(0, 47) + "...";
            }
        }


        /// <summary>
        /// Initializes a new instance of the <see cref="Clip"/> class.
        /// </summary>
        public Clip()
        {
            this.Id = Guid.NewGuid();
        }
    }
}
